Error Message Customization

Use RegisterJScriptAlert to Display Messages

Description
The RegisterJScriptAlert method can be used to display a message in user defined methods, BaseClasses methods, or in events.
Variables
Button Control
Select the button
Applies to
P_Button Control class
Code
 
	/// 
	/// Event handler for Button. Add custom logic to display an error message on ${Button Control}_Click
	/// 
	public override void ${Button Control}_Click(object sender, EventArgs args)
	{
		// Add your logic to decide when to display alert message
		BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "MyAlertName", "My Alert Text");
		
		// If you are redirecting to some other page then, it should not redirect when you display the alert message. Otherwise, the alert message will not be displayed.
		// For this, you can use the following logic:
		// bool shouldRedirect = true;
	    // if ("Show alert message codition is true") {
		//	 BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "MyAlertName", "My Alert Text");
		//	  shouldRedirect = false;
		// }
		// if (shouldRedirect) {
        //    this.Page.ShouldSaveControlsToSession = true;
        //    this.Page.Response.Redirect(url);
        // }
		 
	}
 
 

Terms of Service Privacy Statement